<?php
/**
 * Created by PhpStorm.
 * User: changyifan
 * Date: 2018/3/13
 * Time: 上午10:30
 */

namespace Home\Model;
use Think\Model\BaseModel;

class TeachercourseModel extends BaseModel{

     protected $_link = array(
         'Course' => array(
             'mapping_type' => self::BELONGS_TO,
             'class_name' => 'Course',
             'foreign_key' => 'cou_id',
             'mapping_fields' => 'cou_name',
             'as_fields' => 'name'
         ),
     );

     public function getTeacherCourseNounInfoList($teacher_id){
         $info = $this->where(array('tea_id'=> $teacher_id))->relation('Course')->select();
         if ($info){
             return $info;
         }
         return array();
     }
     public function getTeacherCourseNounInfoListWithCurrentTeacher(){
         $info = $this->where(array('tea_id'=> $this->tea_id))->relation('Course')->select();
         if ($info){
             return $info;
         }
         return array();
        }


}